<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>工程单据管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		function showGuideModel(id,billStatus){
			$("#ddf").val(id);
			$("#billStatusddf").val(billStatus);
			$("#mymodal").modal('show');
		}
		
		function auditSucD(id){
			var path = "${ctx}/bill/bizProjectBill/audit";
			if($("#billStatusddf").attr("value")==1){
				$("#billStatusddf").val(2);
			}else if($("#billStatusddf").attr("value")==0){
				$("#billStatusddf").val(1);
			}
		    $('#inputFormF').attr("action", path).submit();;
		}
		
		function auditFailD(id,billStatus){
			var path = "${ctx}/bill/bizProjectBill/audit";
			$("#billStatusddf").val(-1);
		    $('#inputFormF').attr("action", path).submit();;
		}
	</script>
</head>
<body>
	<form:form id="searchForm" modelAttribute="bizProjectBill" action="${ctx}/bill/bizProjectBill/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>中心名称：</label>
				<form:input path="proName" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li><label>运行模式：</label>
				<form:select path="proType" class="input-medium">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('proType')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li><label>拟开工时间：</label>
				<input name="proStartTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${bizProjectBill.proStartTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</li>
			<li><label>拟建成时间：</label>
				<input name="proEndTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${bizProjectBill.proEndTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
		
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="width:1200px;margin-left: -700px">
		    <div class="modal-dialog">
		        <div class="modal-content">
		            <div class="modal-header">
		                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		                <h4 class="modal-title" id="myModalLabel">审批</h4>
		            </div>
		            <div class="modal-body">
		            	<form id="inputFormF"  method="post" class="form-horizontal">
							<input type="hidden" name="id" id="ddf"/>
							<input type="hidden" name="billStatus" id="billStatusddf"/>
							<div class="control-group">
								<label class="control-label">批复单位：</label>
								<div class="controls">
									<input type="text" name="applyCompany"  maxlength="64" class="input-xlarge "/>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">批复日期：</label>
								<div class="controls">
									<input name="applyDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
										value="<fmt:formatDate value="${bizProjectBill.applyDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
										onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">批复文号：</label>
								<div class="controls">
									<input type="text" name="applyFileNo" htmlEscape="false" maxlength="64" class="input-xlarge "/>
								</div>
							</div>
							<div class="form-actions">
								<button class="btn btn-primary" id="auditSuc" onclick="javascript:auditSucD()">通过</button>
								<button class="btn btn-primary" id="auditFail" onclick="javascript:auditFailD()">驳回</button>
							</div>
						</form>
		            </div>
		        </div><!-- /.modal-content -->
		    </div><!-- /.modal -->
	  </div>
	
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>工程中心编码</th>
				<th>工程中心名称</th>
				<th>运行模式</th>
				<th>申请类型</th>
				<th>地区名称</th>
				<th>分类名称</th>
				<th>细分领域名称</th>
				<th>审核状态</th>
				<th>批复单位</th>
				<th>批复日期</th>
				<th>批复文号</th>
				<th>更新时间</th>
				<shiro:hasPermission name="bill:bizProjectBill:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="bizProjectBill">
			<tr>
				<td><a href="${ctx}/bill/bizProjectBill/form?opt=detail&id=${bizProjectBill.id}">
					${bizProjectBill.id}
				</a></td>
				<td>
					${bizProjectBill.proName}
				</td>
				<td>
					${fns:getDictLabel(bizProjectBill.proType, 'proType', '')}
				</td>
				<td>
					${fns:getDictLabel(bizProjectBill.billType, 'billType', '')}
				</td>
				<td>
					${bizProjectBill.provinceName}
				</td>
				<td>
					${fns:getDictLabel(bizProjectBill.categoryId, 'category_id', '')}
				</td>
				<td>
					${fns:getDictLabel(bizProjectBill.subCategoryId, 'sub_category_id', '')}
				</td>
				<td>
					${bizProjectBill.billStatusName}
				</td>

				<td>
					${bizProjectBill.applyCompany}
				</td>
				<td>
					<fmt:formatDate value="${bizProjectBill.applyDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${bizProjectBill.applyFileNo}
				</td>
				<td>
					<fmt:formatDate value="${bizProjectBill.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<c:choose>
	                	<c:when test="${bizProjectBill.billStatus eq 0 }">
	                    	<button class="btn btn-sm" data-toggle="modal" onclick="javascript:showGuideModel('${bizProjectBill.id}','${bizProjectBill.billStatus}')" data-target="#myModal">审批</button>
		                </c:when>
		                <c:when test="${bizProjectBill.billStatus eq 1 }">
		                    <button class="btn btn-sm" data-toggle="modal" onclick="javascript:showGuideModel('${bizProjectBill.id}','${bizProjectBill.billStatus}')" data-target="#myModal">审批</button>
		                </c:when>
		            </c:choose>
		             <a href="${ctx}/bill/bizProjectBill/form?id=${bizProjectBill.id}">修改</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>